News All Tests
Current file: /home/estudydev/workspace/MSP09/web/news/tests/class.XmlImport.inc.php
Legend: executed not executed dead code

  Coverage
  Classes Methods Lines
Total
100.00 %100.00%
100.00% 1 / 1
0.00 %0.00%
0.00% 0 / 17
45.45 %45.45%
45.45% 5 / 11
 
XmlImport
100.00 %100.00%
100.00% 1 / 1
0.00 %0.00%
0.00% 0 / 17
14.29 %14.29%
14.29% 1 / 7
 public function __construct()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 6
 public function XmlImport()
0.00 %0.00%
0.00% 0 / 1
100.00 %100.00%
100.00% 0 / 0
 public function save_file($datei)
0.00 %0.00%
0.00% 0 / 1
100.00 %100.00%
100.00% 0 / 0
 public function get_modulinfos_from_temp()
0.00 %0.00%
0.00% 0 / 1
100.00 %100.00%
100.00% 0 / 0
 public function get_latest_modulinfos_from_db()
0.00 %0.00%
0.00% 0 / 1
100.00 %100.00%
100.00% 0 / 0
 public static function get_modul_by_modulID($modul_ID)
0.00 %0.00%
0.00% 0 / 1
100.00 %100.00%
100.00% 0 / 0
 public function import_all()
0.00 %0.00%
0.00% 0 / 1
100.00 %100.00%
100.00% 0 / 0
 public function import_sel($sel_moduls)
0.00 %0.00%
0.00% 0 / 1
100.00 %100.00%
100.00% 0 / 0
 public static function get_latest_ID_by_MSC($modulShortCut)
0.00 %0.00%
0.00% 0 / 1
100.00 %100.00%
100.00% 0 / 0
 public static function get_modul_id($modul)
0.00 %0.00%
0.00% 0 / 1
100.00 %100.00%
100.00% 0 / 0
 public static function get_unused_moduls()
0.00 %0.00%
0.00% 0 / 1
100.00 %100.00%
100.00% 0 / 0
 public static function del_unused_moduls()
0.00 %0.00%
0.00% 0 / 1
100.00 %100.00%
100.00% 0 / 0
 public static function del_modul($modul_id)
0.00 %0.00%
0.00% 0 / 1
100.00 %100.00%
100.00% 0 / 0
 private function unzip_file($dateipfad)
0.00 %0.00%
0.00% 0 / 1
100.00 %100.00%
100.00% 0 / 0
 private function validate_file($datei)
0.00 %0.00%
0.00% 0 / 1
100.00 %100.00%
100.00% 0 / 0
 private function insert_in_db($modul)
0.00 %0.00%
0.00% 0 / 1
100.00 %100.00%
100.00% 0 / 0
 private function clear_temp()
0.00 %0.00%
0.00% 0 / 1
100.00 %100.00%
100.00% 0 / 0


       1                 : <?php                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
       2                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
       3                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
       4                 : /*--------------------------------------------------------------------------+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
       5                 : This file is part of eStudy.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
       6                 : admin/classes/class.XmlImport.inc.php                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
       7                 : - Modulgruppe:  Portal-Administration                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
       8                 : - Beschreibung: Dieses Modul behandelt "XML-Import"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
       9                 : - Version:      0.1, 24/07/07                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
      10                 : - Autor(en):    Christian Ketter <christian.ketter@mni.fh-giessen.de>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
      11                 : +---------------------------------------------------------------------------+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
      12                 : This program is free software; you can redistribute it and/or                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
      13                 : modify it under the terms of the GNU General Public License                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
      14                 : as published by the Free Software Foundation; either version 2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
      15                 : of the License, or any later version.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
      16                 : +---------------------------------------------------------------------------+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
      17                 : This program is distributed in the hope that it will be useful,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      18                 : but WITHOUT ANY WARRANTY; without even the implied warranty of                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
      19                 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
      20                 : GNU General Public License for more details.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
      21                 : You should have received a copy of the GNU General Public License                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      22                 : along with this program; if not, write to the Free Software                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
      23                 : Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
      24                 : +--------------------------------------------------------------------------*/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
      25                 : /**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
      26                 :  * In dieser Datei wird die Klasse "XmlImport" implementiert.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
      27                 :  * @package eStudy.admin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
      28                 :  *  * @author Christian Ketter <christian.ketter@mni.fh-giessen.de>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
      29                 :  * @version  0.2, 12/03/08                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
      30                 :  */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
      31                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      32                 : /** relativer Pfad zum Root des Portals */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
      33               1 : if (!defined("PATH_TO_ROOT"))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
      34               1 :     define("PATH_TO_ROOT", "../../");                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
      35                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      36               1 : require_once ("class.XmlFile.inc.php");                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
      37               1 : require_once ("class.usertools.inc.php"); //Tools-Klasse                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
      38                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      39               1 : class XmlImport {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      40                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      41                 :     private $uploaddir;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
      42                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      43                 :     /* Ab PHP 5 */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
      44                 :     function __construct() {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
      45               0 :         global $settings;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
      46                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      47                 :         /* Konstruktion des Uploadverzeichnisses als absoluten Pfad (, da die ZIP-Funktionen im (PHP) module mode                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      48                 :          *  einen absoluten Pfad erwarten)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
      49                 :          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
      50                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      51               0 :         if (!is_dir(PATH_TO_ROOT . $settings["upload_path"] . "xmlImport/"))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
      52               0 :            @ mkdir(PATH_TO_ROOT . $settings["upload_path"] . "xmlImport/", 0777);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      53                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      54               0 :         $this->uploaddir = realpath(PATH_TO_ROOT . $settings["upload_path"] . "xmlImport");                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
      55               0 :         $this->uploaddir .= "/"; // realpath wuerde letztes "/" verschlucken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
      56                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      57               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
      58                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      59                 :     /* Für PHP 4 */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
      60                 :     function XmlImport() {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
      61                 :         $this->__construct();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
      62                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
      63                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      64                 :     function save_file($datei) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
      65                 :         if (!move_uploaded_file($datei['tmp_name'], $this->uploaddir . $datei['name']))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
      66                 :             return false;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
      67                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      68                 :         if (!$this->unzip_file($this->uploaddir . $datei['name']))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
      69                 :             return false;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
      70                 :         return true;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
      71                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
      72                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      73                 :     function get_modulinfos_from_temp() {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
      74                 :         $moduls = array ();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
      75                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      76                 :         if ($ordner = opendir($this->uploaddir)) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
      77                 :             while (false !== ($file = readdir($ordner))) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
      78                 :                 if (true === $this->validate_file($file)) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
      79                 :                     array_push($moduls, new XmlFile($this->uploaddir . $file));                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      80                 :                 }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      81                 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
      82                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      83                 :             return $moduls;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
      84                 :             closedir($ordner);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
      85                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
      86                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
      87                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      88                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      89                 :     /* Es werden nur die Module zurückgegegeben, die bei mehreren auftretenden Modulkürzel die höchste ID haben, (also die Aktuellsten) */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
      90                 :     function get_latest_modulinfos_from_db() {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
      91                 :         global $db, $EZSQL_ERROR;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      92                 :         $moduls = array ();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
      93                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      94                 :         // Die höchste ID zuerst...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
      95                 :         $query = "SELECT * FROM modulbeschreibungen ORDER BY 'modul_id' DESC ";                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      96                 :         $errorCount = count($EZSQL_ERROR);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
      97                 :         $sql = $db->get_results($query, ARRAY_N);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      98                 :         $cnt = 0;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      99                 :         foreach ($sql as $modul) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
     100                 :                 $msc_used = false;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
     101                 :                 // Prüfen, ob das Modulkürzel (mit der höchsten ID) bereits erfasst wurde                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     102                 :                 foreach ($moduls as $modul_inner) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     103                 :                     if ($modul_inner->modulkuerzel == $modul[2])                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     104                 :                        $msc_used = true;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     105                 :                 }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     106                 :                 // Falls ja, überspringe aktuellen Schleifendurchlauf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     107                 :                 if ($msc_used)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     108                 :                    continue;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     109                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     110                 :                 array_push($moduls, new XmlFile());                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     111                 :                 $moduls[$cnt]->modulkuerzel = $modul[2];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     112                 :                 $moduls[$cnt++]->modultitel = $modul[3];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     113                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     114                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     115                 :         if (count($EZSQL_ERROR) > $errorCount)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     116                 :             Output :: errorMessage("Fataler Fehler beim Datenbankzugriff aufgetreten!", 1, false, true);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     117                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     118                 :     /*    /* Vertauscht die Elemente hinten und vorne, damit die Modulkürzel eher absteigend sortiert sind                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
     119                 :         return array_reverse($moduls);   */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
     120                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     121                 :         return $moduls;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
     122                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     123                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     124                 :     static function get_modul_by_modulID($modul_ID) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     125                 :            global $db, $EZSQL_ERROR;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
     126                 :            $modul_inhalt = new XmlFile();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     127                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     128                 :            $query = "SELECT * from modulbeschreibungen WHERE modul_ID = '$modul_ID'";                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     129                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     130                 :            $errorCount = count($EZSQL_ERROR);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     131                 :            $sql = $db->get_results($query, ARRAY_N);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
     132                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     133                 :            if ($sql != FALSE){                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     134                 :                foreach ($sql as $modul){                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     135                 :                    $modul_inhalt->modul_ID = $modul[0];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
     136                 :                    $modul_inhalt->studiengang = $modul[1];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     137                 :                    $modul_inhalt->modulkuerzel = $modul[2];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
     138                 :                    $modul_inhalt->modultitel = $modul[3];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     139                 :                    $modul_inhalt->lernziele = $modul[4];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     140                 :                    $modul_inhalt->lerninhalt = $modul[5];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     141                 :                    $modul_inhalt->modultyp = $modul[6];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
     142                 :                    $modul_inhalt->lehrformen = $modul[7];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     143                 :                    $modul_inhalt->literatur = $modul[8];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     144                 :                    $modul_inhalt->creditpoints = $modul[9];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
     145                 :                    $modul_inhalt->voraussetzungen = $modul[10];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     146                 :                    $modul_inhalt->kurzbeschreibung = $modul[11];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     147                 :                }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     148                 :            }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     149                 :            else{                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     150                 :               // Wenn der Kurs unter der ID nicht gefunden wird, wird -1 für die modul_id zurückgegeben                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     151                 :                  $modul_inhalt->modul_ID = -1;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     152                 :               return $modul_inhalt;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     153                 :            }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     154                 :            if (count($EZSQL_ERROR) > $errorCount)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     155                 :               Output :: errorMessage("Fataler Fehler beim Datenbankzugriff aufgetreten!", 1, false, true);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     156                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     157                 :            return $modul_inhalt;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     158                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     159                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     160                 :     function import_all() {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
     161                 :         $moduls = $this->get_modulinfos_from_temp();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
     162                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     163                 :         foreach ($moduls as $modul)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     164                 :             $this->insert_in_db($modul);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     165                 :         $this->clear_temp();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     166                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     167                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     168                 :     function import_sel($sel_moduls) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     169                 :         $moduls = $this->get_modulinfos_from_temp();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
     170                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     171                 :         if ($sel_moduls === NULL)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     172                 :            return; // Falls nichts ausgewaehlt wurde, nicht importieren                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
     173                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     174                 :         foreach ($moduls as $modul) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     175                 :             if (in_array($modul->modulkuerzel, $sel_moduls))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     176                 :                 $this->insert_in_db($modul);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     177                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     178                 :         $this->clear_temp();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     179                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     180                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     181                 :     static function get_latest_ID_by_MSC($modulShortCut) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     182                 :         global $db, $EZSQL_ERROR;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     183                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     184                 :         $query = "SELECT modul_id FROM modulbeschreibungen WHERE modulkuerzel=\"" . $modulShortCut . "\"";                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     185                 :         $errorCount = count($EZSQL_ERROR);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     186                 :         $sql = $db->get_results($query, ARRAY_N);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     187                 :         if (count($EZSQL_ERROR) > $errorCount)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     188                 :             Output :: errorMessage("Fataler Fehler beim Datenbankzugriff aufgetreten!", 1, false, true);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     189                 :         if (count($sql) < 1)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     190                 :             return -1;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     191                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     192                 :         return $sql[count($sql) - 1][0]; //Letzte ID wird zurück gegeben                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     193                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     194                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     195                 :     static function get_modul_id($modul) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     196                 :         global $db, $EZSQL_ERROR;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     197                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     198                 :         $query = "SELECT modul_id FROM modulbeschreibungen WHERE modulkuerzel=\"" . $modul->modulkuerzel . "\"";                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     199                 :         $errorCount = count($EZSQL_ERROR);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     200                 :         $row = $db->get_row($query, ARRAY_N);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     201                 :         if (count($EZSQL_ERROR) > $errorCount)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     202                 :             Output :: errorMessage("Fataler Fehler beim Datenbankzugriff aufgetreten!", 1, false, true);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     203                 :         if (count($row) < 1)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     204                 :             return -1;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     205                 :         return $row[0];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
     206                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     207                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     208                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     209                 :     static function get_unused_moduls() {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     210                 :         global $db, $EZSQL_ERROR;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     211                 :         $moduls = array ();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
     212                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     213                 :         /* Module, die referenzeiert werden*/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     214                 :         $query = "SELECT modul_id                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     215                 :                          FROM modulbeschreibungen INNER JOIN courses                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
     216                 :                          ON (modul_ID = modulbeschreibung_ID)";                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     217                 :         $errorCount = count($EZSQL_ERROR);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     218                 :         $sql = $db->get_results($query, ARRAY_N);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     219                 :         $cnt = 0;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     220                 :         if ( $sql !== NULL ) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     221                 :             foreach ($sql as $modul) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     222                 :                 array_push($moduls, new XmlFile());                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     223                 :                 $moduls[$cnt++]->modul_ID = $modul[0];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     224                 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     225                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     226                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     227                 :         /* Module, die NICHT referenziert werden*/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
     228                 :         $query = "SELECT modul_id, studiengang, modulkuerzel, modultitel                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     229                 :                          FROM modulbeschreibungen                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     230                 :                          WHERE ";                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     231                 :         foreach ($moduls as $modul)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     232                 :             $query .= "(modul_id != '" . $modul->modul_ID . "') AND ";                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     233                 :         $query = substr($query, 0, strlen($query) - 5); //Letztes "AND" entfernen                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     234                 :         $errorCount = count($EZSQL_ERROR);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     235                 :         $sql = $db->get_results($query, ARRAY_N);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     236                 :         unset ($moduls);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     237                 :         $moduls = array (); // Array neu erzeugen                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     238                 :         $cnt = 0;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     239                 :         if ( $sql !== NULL ) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     240                 :             foreach ($sql as $modul) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     241                 :                 array_push($moduls, new XmlFile());                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     242                 :                 $moduls[$cnt]->modul_ID = $modul[0];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
     243                 :                 $moduls[$cnt]->studiengang = $modul[1];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
     244                 :                 $moduls[$cnt]->modulkuerzel = $modul[2];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     245                 :                 $moduls[$cnt++]->modultitel = $modul[3];                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     246                 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     247                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     248                 :         if (count($EZSQL_ERROR) > $errorCount)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     249                 :             Output :: errorMessage("Fataler Fehler beim Datenbankzugriff aufgetreten!", 1, false, true);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     250                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     251                 :         return $moduls;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
     252                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     253                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     254                 :     static function del_unused_moduls() {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     255                 :         global $db, $EZSQL_ERROR;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     256                 :         $moduls = XmlImport :: get_unused_moduls();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     257                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     258                 :         //Alle ungebrauchten Module loeschen                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     259                 :         foreach ($moduls as $modul)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     260                 :             XmlImport :: del_modul($modul->modul_ID);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     261                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     262                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     263                 :     static function del_modul($modul_id) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     264                 :         global $db, $EZSQL_ERROR;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     265                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     266                 :         $query = "DELETE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     267                 :                             FROM modulbeschreibungen                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
     268                 :                             WHERE modul_id = \"$modul_id\"";                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     269                 :         $errorCount = count($EZSQL_ERROR);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     270                 :         $sql = $db->query($query);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
     271                 :         if (count($EZSQL_ERROR) > $errorCount)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     272                 :             Output :: errorMessage("Fataler Fehler beim Datenbankzugriff aufgetreten!", 1, false, true);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     273                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     274                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     275                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     276                 :     private function unzip_file($dateipfad) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     277                 :         $ziel_ordner = $this->uploaddir;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     278                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     279                 :         //ZIP-Datei öffnen und in $ziel_ordner extrahieren                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
     280                 :         $zip = zip_open($dateipfad);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
     281                 :         if (!is_resource($zip))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     282                 :             return false;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     283                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     284                 :         if ($zip) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     285                 :             while ($zip_entry = zip_read($zip)) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     286                 :                 $file_name = zip_entry_name($zip_entry);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     287                 :                 $file_size = zip_entry_filesize($zip_entry);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     288                 :                 $comp_meth = zip_entry_compressionmethod($zip_entry);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     289                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     290                 :                 if (zip_entry_open($zip, $zip_entry, 'rb')) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     291                 :                     $buffer = zip_entry_read($zip_entry, $file_size);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     292                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     293                 :                     if (preg_match('/\/$/', $file_name) && ($comp_meth == 'stored')) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     294                 :                         if (!is_dir($ziel_ordner . $file_name))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     295                 :                             @ mkdir($ziel_ordner . $file_name, 0777);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     296                 :                     } else {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     297                 :                         $fp = fopen($ziel_ordner . $file_name, 'wb');                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     298                 :                         fwrite($fp, $buffer);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     299                 :                         fclose($fp);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
     300                 :                     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     301                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     302                 :                     zip_entry_close($zip_entry);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     303                 :                 }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     304                 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     305                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     306                 :             zip_close($zip);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     307                 :             unlink($dateipfad); //Löschen der ZIP-Datei                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     308                 :         } else                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     309                 :             return false;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     310                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     311                 :         return true;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
     312                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     313                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     314                 :     private function validate_file($datei) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     315                 :         if ((StrToLower(substr($datei, strlen($datei) - 3, 3)) != "xml") || (StrToLower(substr($datei, 0, 8)) == "dozenten"))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     316                 :             return false;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     317                 :         return true;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
     318                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     319                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     320                 :     private function insert_in_db($modul) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
     321                 :         global $db, $EZSQL_ERROR;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     322                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     323                 :         $errorCount = count($EZSQL_ERROR);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     324                 :         // if ($this->get_modul_id($modul) === -1){                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     325                 :         $query = "INSERT INTO modulbeschreibungen (studiengang,modulkuerzel,modultitel,lernziele,lerninhalt,modultyp,lehrformen,literatur,creditpoints,voraussetzungen,kurzbeschreibung)" .                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
     326                 :         "values (\"" . Data :: toMysql(utf8_decode($modul->studiengang)) . "\",\"" . Data :: toMysql(utf8_decode($modul->modulkuerzel)) . "\",\"" . Data :: toMysql(utf8_decode($modul->modultitel)) . "\",\"" . Data :: toMysql(utf8_decode($modul->lernziele)) . "\",\"" . Data :: toMysql(utf8_decode($modul->lerninhalt)) . "\",\"" . Data :: toMysql(utf8_decode($modul->modultyp)) . "\",\"" . Data :: toMysql(utf8_decode($modul->lehrformen)) . "\",\"" . Data :: toMysql(utf8_decode($modul->literatur)) . "\"," . Data :: toMysql(utf8_decode($modul->creditpoints)) . ",\"" . Data :: toMysql(utf8_decode($modul->voraussetzungen)) . "\", \"" . Data :: toMysql(utf8_decode($modul->kurzbeschreibung)) . "\")";
     327                 :         $sql = $db->query($query);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
     328                 :         //  }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     329                 :         /* if else Struktur nur notwendig, wenn alte Modulbeschreibungen eines Modulkürzels durch eine neue Modulbescheibung ersetzt werden sollen                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     330                 :          * else{                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
     331                 :              $modul_id = $this->get_modul_id($modul);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     332                 :              $query = "DELETE FROM modulbeschreibungen WHERE modulkuerzel = \"$modul->modulkuerzel\"";                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     333                 :              $sql = $db->query($query);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
     334                 :              $query = "INSERT INTO modulbeschreibungen (modul_id,studiengang,modulkuerzel,modultitel,lernziele,lerninhalt,modultyp,lehrformen,literatur,creditpoints,voraussetzungen,kurzbeschreibung)" .                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     335                 :                         "values (".$modul_id.",\"".Data::toMysql(utf8_decode($modul->studiengang))."\",\"".Data::toMysql(utf8_decode($modul->modulkuerzel))."\",\"".Data::toMysql(utf8_decode($modul->modultitel))."\",\"".Data::toMysql(utf8_decode($modul->lernziele))."\",\"".Data::toMysql(utf8_decode($modul->lerninhalt))."\",\"".Data::toMysql(utf8_decode($modul->modultyp))."\",\"".Data::toMysql(utf8_decode($modul->lehrformen))."\",\"".Data::toMysql(utf8_decode($modul->literatur))."\",".Data::toMysql(utf8_decode($modul->creditpoints)).",\"".Data::toMysql(utf8_decode($modul->voraussetzungen))."\", \"".Data::toMysql(utf8_decode($modul->kurzbeschreibung))."\")";                                    
     336                 :              $sql = $db->query($query);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
     337                 :           }*/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
     338                 :         if (count($EZSQL_ERROR) > $errorCount)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
     339                 :             Output :: errorMessage("Fataler Fehler beim Datenbankzugriff aufgetreten!", 1, false, true);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     340                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     341                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
     342                 :     private function clear_temp() {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
     343                 :         $temp = opendir($this->uploaddir);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     344                 :         while ($filename = readdir($temp)) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     345                 :             if ($filename != "." && $filename != ".." && $filename != "CVS")                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
     346                 :                 unlink($this->uploaddir . $filename);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     347                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
     348                 :         closedir($temp);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     349                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     350                 : }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
     351                 : ?>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

Generated by PHPUnit 3.2.21 and Xdebug 2.0.4 at Sat Nov 7 22:04:08 CET 2009.